use Dosvid
go

alter table Vacancies add VacancyTypeId int null
go

update Vacancies set
  VacancyTypeId = case 
                    when IsArchive = 1 then 1
                    else 4
                  end  
go

alter table Vacancies alter column VacancyTypeId int not null
go

alter table Vacancies add constraint FK_Vacancies_Vacancy_Types_VacancyTypeId 
      foreign key (VacancyTypeId) references Vacancy_Types(Id)
go

